home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.xa;
-
- import com.extensibility.app.BaseAction;
- import com.extensibility.app.UI;
- import com.extensibility.rock.RBevelBorder;
- import com.extensibility.rock.RTabbedPane;
- import com.extensibility.util.RuleSplitPane;
- import com.extensibility.xml.BaseDeclaration;
- import com.extensibility.xml.DataTypeDeclaration;
- import com.extensibility.xml.DeclarationChangeEvent;
- import com.extensibility.xml.ExternalGEDeclaration;
- import com.extensibility.xml.ExternalPEDeclaration;
- import com.extensibility.xml.ExternalSubset;
- import com.extensibility.xml.GeneralEntityDeclaration;
- import com.extensibility.xml.InternalGEDeclaration;
- import com.extensibility.xml.InternalPEDeclaration;
- import com.extensibility.xml.NamespaceDeclaration;
- import com.extensibility.xml.NotationDeclaration;
- import com.extensibility.xml.ParameterEntityDeclaration;
- import com.extensibility.xml.ProcessingInstruction;
- import com.extensibility.xml.SchemaFlavorIntf;
- import java.awt.BorderLayout;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Font;
- import javax.swing.JComponent;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.border.Border;
-
- public class AdvancedPane extends CompositePane implements SchemaDocListener {
- static final int MIN_WIDTH = 100;
- static final int MIN_HEIGHT = 20;
- public static final int TAB_GE = 0;
- public static final int TAB_PE = 1;
- public static final int TAB_NOTATION = 2;
- public static final int TAB_DT = 3;
- public static final int TAB_NS = 4;
- public static final int TAB_PI = 5;
- RTabbedPane tabPane;
- EntityTable ipeTable;
- EntityTable xpeTable;
- RuleSplitPane peSplit;
- JScrollPane ipeScroll;
- JScrollPane xpeScroll;
- EntityTable igeTable;
- EntityTable xgeTable;
- RuleSplitPane geSplit;
- JScrollPane igeScroll;
- JScrollPane xgeScroll;
- NotationTable notTable;
- JScrollPane notScroll;
- PITable piTable;
- JScrollPane piScroll;
- NamespaceTable nsTable;
- JScrollPane nsScroll;
- DataTypeTable dtTable;
- JScrollPane dtScroll;
- // $FF: renamed from: jp javax.swing.JPanel
- JPanel field_0;
- DeclTable tableLastSelected;
- public CutAction cutAction;
- public CopyAction copyAction;
- public PasteAction pasteAction;
- public ClearAction clearAction;
- public ExpandAction expandAction;
-
- public AdvancedPane(SchemaDoc var1) {
- super(var1);
- var1.addDocumentListener(this);
- this.field_0 = new JPanel();
- this.field_0.setBorder(new RBevelBorder(1));
- this.field_0.setLayout(new BorderLayout());
- this.ipeTable = new EntityTable(new EntityModel(var1, true, false));
- this.ipeScroll = new JScrollPane(this.ipeTable);
- this.ipeScroll.setBorder((Border)null);
- this.ipeScroll.setHorizontalScrollBarPolicy(31);
- this.ipeScroll.setVerticalScrollBarPolicy(22);
- this.ipeScroll.setCorner("UPPER_RIGHT_CORNER", this.ipeTable.createCorner());
- this.ipeScroll.setMinimumSize(new Dimension(100, 20));
- this.xpeTable = new EntityTable(new EntityModel(var1, false, false));
- this.xpeScroll = new JScrollPane(this.xpeTable);
- this.xpeScroll.setBorder((Border)null);
- this.xpeScroll.setMinimumSize(new Dimension(100, 20));
- this.xpeScroll.setHorizontalScrollBarPolicy(31);
- this.xpeScroll.setVerticalScrollBarPolicy(22);
- this.xpeScroll.setCorner("UPPER_RIGHT_CORNER", this.xpeTable.createCorner());
- this.igeTable = new EntityTable(new EntityModel(var1, true, true));
- this.igeScroll = new JScrollPane(this.igeTable);
- this.igeScroll.setBorder((Border)null);
- this.igeScroll.setMinimumSize(new Dimension(100, 20));
- this.igeScroll.setHorizontalScrollBarPolicy(31);
- this.igeScroll.setVerticalScrollBarPolicy(22);
- this.igeScroll.setCorner("UPPER_RIGHT_CORNER", this.igeTable.createCorner());
- this.xgeTable = new EntityTable(new EntityModel(var1, false, true));
- this.xgeScroll = new JScrollPane(this.xgeTable);
- this.xgeScroll.setBorder((Border)null);
- this.xgeScroll.setMinimumSize(new Dimension(100, 20));
- this.xgeScroll.setHorizontalScrollBarPolicy(31);
- this.xgeScroll.setVerticalScrollBarPolicy(22);
- this.xgeScroll.setCorner("UPPER_RIGHT_CORNER", this.xgeTable.createCorner());
- this.notTable = new NotationTable(new NotationModel(var1));
- this.notScroll = new JScrollPane(this.notTable);
- this.notScroll.setBorder((Border)null);
- this.notScroll.setMinimumSize(new Dimension(100, 20));
- this.notScroll.setHorizontalScrollBarPolicy(31);
- this.notScroll.setVerticalScrollBarPolicy(22);
- this.notScroll.setCorner("UPPER_RIGHT_CORNER", this.notTable.createCorner());
- this.piTable = new PITable(new PIModel(var1));
- this.piScroll = new JScrollPane(this.piTable);
- this.piScroll.setBorder((Border)null);
- this.piScroll.setMinimumSize(new Dimension(100, 20));
- this.piScroll.setHorizontalScrollBarPolicy(31);
- this.piScroll.setVerticalScrollBarPolicy(22);
- this.piScroll.setCorner("UPPER_RIGHT_CORNER", this.piTable.createCorner());
- this.peSplit = new RuleSplitPane(0, this.ipeScroll, this.xpeScroll);
- this.peSplit.setDividerRule((double)0.5F);
- this.peSplit.setBorder((Border)null);
- this.geSplit = new RuleSplitPane(0, this.igeScroll, this.xgeScroll);
- this.geSplit.setDividerRule((double)0.5F);
- this.geSplit.setBorder((Border)null);
- this.nsTable = new NamespaceTable(new NamespaceModel(var1));
- this.nsScroll = new JScrollPane(this.nsTable);
- this.nsScroll.setBorder((Border)null);
- this.nsScroll.setHorizontalScrollBarPolicy(31);
- this.nsScroll.setVerticalScrollBarPolicy(22);
- this.nsScroll.setCorner("UPPER_RIGHT_CORNER", this.nsTable.createCorner());
- this.dtTable = new DataTypeTable(new DataTypeModel(var1));
- this.dtScroll = new JScrollPane(this.dtTable);
- this.dtScroll.setBorder((Border)null);
- this.dtScroll.setHorizontalScrollBarPolicy(31);
- this.dtScroll.setVerticalScrollBarPolicy(22);
- this.dtScroll.setCorner("UPPER_RIGHT_CORNER", this.dtTable.createCorner());
- this.tabPane = new RTabbedPane();
- Font var2 = UI.getAppFont();
- if (var2 != null) {
- this.tabPane.setFont(var2);
- }
-
- this.tableLastSelected = this.ipeTable;
- this.tabPane.addTab(UI.getString("tab.xmlvars.label"), UI.getIcon("tbGE.gif"), this.geSplit);
- this.tabPane.addTab(UI.getString("tab.dtdvars.label"), UI.getIcon("tbPE.gif"), this.peSplit);
- this.tabPane.addTab(UI.getString("tab.notations.label"), UI.getIcon("tbNT.gif"), this.notScroll);
- this.tabPane.addTab(UI.getString("tab.dt.label"), UI.getIcon("tbDT.gif"), this.dtScroll);
- this.tabPane.addTab(UI.getString("tab.ns.label"), UI.getIcon("tbNS.gif"), this.nsScroll);
- this.tabPane.addTab(UI.getString("tab.pi.label"), UI.getIcon("tbPI.gif"), this.piScroll);
- this.setTabs();
- this.tabPane.addChangeListener(new 1(this));
- this.field_0.add(this.tabPane, "Center");
- this.ipeTable.addListSelectionListener(new 2(this));
- this.xpeTable.addListSelectionListener(new 3(this));
- this.igeTable.addListSelectionListener(new 4(this));
- this.xgeTable.addListSelectionListener(new 5(this));
- this.notTable.addListSelectionListener(new 6(this));
- this.piTable.addListSelectionListener(new 7(this));
- this.nsTable.addListSelectionListener(new 8(this));
- this.dtTable.addListSelectionListener(new 9(this));
- this.cutAction = new CutAction(this);
- this.copyAction = new CopyAction(this);
- this.pasteAction = new PasteAction(this);
- this.clearAction = new ClearAction(this);
- this.expandAction = new ExpandAction(this);
- this.updateEditActions();
- }
-
- public Class getCurrentClass() {
- switch (this.getIDOfIndex(this.tabPane.getSelectedIndex())) {
- case 0:
- return Class.forName("com.extensibility.xml.GeneralEntityDeclaration");
- case 1:
- return Class.forName("com.extensibility.xml.ParameterEntityDeclaration");
- case 2:
- return Class.forName("com.extensibility.xml.NotationDeclaration");
- case 3:
- return Class.forName("com.extensibility.xml.DataTypeDeclaration");
- case 4:
- return Class.forName("com.extensibility.xml.NamespaceDeclaration");
- case 5:
- return Class.forName("com.extensibility.xml.ProcessingInstruction");
- default:
- return null;
- }
- }
-
- public JComponent getComponent() {
- return this.field_0;
- }
-
- public String getClassName() {
- return "com.extensibility.xa.AdvancedPane";
- }
-
- public void choose(Class var1) {
- if (var1 == Class.forName("com.extensibility.xml.GeneralEntityDeclaration")) {
- if (this.getIndexOf(0) < 0) {
- ((CompositePane)this).beep();
- } else {
- this.tabPane.setSelectedIndex(this.getIndexOf(0));
- }
- } else if (var1 == Class.forName("com.extensibility.xml.ParameterEntityDeclaration")) {
- if (this.getIndexOf(1) < 0) {
- ((CompositePane)this).beep();
- } else {
- this.tabPane.setSelectedIndex(this.getIndexOf(1));
- }
- } else if (var1 == Class.forName("com.extensibility.xml.NotationDeclaration")) {
- if (this.getIndexOf(2) < 0) {
- ((CompositePane)this).beep();
- } else {
- this.tabPane.setSelectedIndex(this.getIndexOf(2));
- }
- } else if (var1 == Class.forName("com.extensibility.xml.ProcessingInstruction")) {
- if (this.getIndexOf(5) < 0) {
- ((CompositePane)this).beep();
- } else {
- this.tabPane.setSelectedIndex(this.getIndexOf(5));
- }
- } else if (var1 == Class.forName("com.extensibility.xml.NamespaceDeclaration")) {
- if (this.getIndexOf(4) < 0) {
- ((CompositePane)this).beep();
- } else {
- this.tabPane.setSelectedIndex(this.getIndexOf(4));
- }
- } else if (var1 == Class.forName("com.extensibility.xml.DataTypeDeclaration")) {
- if (this.getIndexOf(3) < 0) {
- ((CompositePane)this).beep();
- } else {
- this.tabPane.setSelectedIndex(this.getIndexOf(3));
- }
- }
-
- }
-
- protected void updateCurrentTable() {
- int var1 = this.tabPane.getSelectedIndex();
- if (var1 != -1) {
- switch (this.getIDOfIndex(var1)) {
- case 0:
- if (this.xgeTable.getSelectedRow() >= 0) {
- this.tableLastSelected = this.xgeTable;
- } else {
- this.tableLastSelected = this.igeTable;
- }
- break;
- case 1:
- if (this.xpeTable.getSelectedRow() >= 0) {
- this.tableLastSelected = this.xpeTable;
- } else {
- this.tableLastSelected = this.ipeTable;
- }
- break;
- case 2:
- this.tableLastSelected = this.notTable;
- break;
- case 3:
- this.tableLastSelected = this.dtTable;
- break;
- case 4:
- this.tableLastSelected = this.nsTable;
- break;
- case 5:
- this.tableLastSelected = this.piTable;
- }
-
- this.updateEditActions();
- }
- }
-
- private void updateEditActions() {
- this.cutAction.updateEnabled();
- this.copyAction.updateEnabled();
- this.pasteAction.updateEnabled();
- this.clearAction.updateEnabled();
- }
-
- public DeclTable getTableForClass(Class var1) {
- if (var1 == Class.forName("com.extensibility.xml.InternalGEDeclaration")) {
- return this.ipeTable;
- } else if (var1 == Class.forName("com.extensibility.xml.ExternalGEDeclaration")) {
- return this.xpeTable;
- } else if (var1 == Class.forName("com.extensibility.xml.InternalPEDeclaration")) {
- return this.igeTable;
- } else if (var1 == Class.forName("com.extensibility.xml.ExternalPEDeclaration")) {
- return this.xgeTable;
- } else if (var1 == Class.forName("com.extensibility.xml.NotationDeclaration")) {
- return this.notTable;
- } else if (var1 == Class.forName("com.extensibility.xml.ProcessingInstruction")) {
- return this.piTable;
- } else if (var1 == Class.forName("com.extensibility.xml.NamespaceDeclaration")) {
- return this.nsTable;
- } else {
- return var1 == Class.forName("com.extensibility.xml.DataTypeDeclaration") ? this.dtTable : null;
- }
- }
-
- public DeclTable getTableForModel(DeclTableModel var1) {
- if (this.igeTable.getModel() == var1) {
- return this.igeTable;
- } else if (this.xgeTable.getModel() == var1) {
- return this.xgeTable;
- } else if (this.ipeTable.getModel() == var1) {
- return this.ipeTable;
- } else if (this.xpeTable.getModel() == var1) {
- return this.xpeTable;
- } else if (this.notTable.getModel() == var1) {
- return this.notTable;
- } else if (this.piTable.getModel() == var1) {
- return this.piTable;
- } else if (this.nsTable.getModel() == var1) {
- return this.nsTable;
- } else {
- return this.dtTable.getModel() == var1 ? this.dtTable : null;
- }
- }
-
- public DeclTable getCurrentTable() {
- return this.tableLastSelected;
- }
-
- public int getSelectedTab() {
- return this.tabPane.getSelectedIndex();
- }
-
- public DeclTable getFirstTable(int var1) {
- switch (var1) {
- case 0:
- return this.igeTable;
- case 1:
- return this.ipeTable;
- case 2:
- return this.notTable;
- case 3:
- return this.dtTable;
- case 4:
- return this.nsTable;
- case 5:
- return this.piTable;
- default:
- return null;
- }
- }
-
- public DeclTable getSecondTable(int var1) {
- switch (var1) {
- case 0:
- return this.xgeTable;
- case 1:
- return this.xpeTable;
- case 2:
- return null;
- case 3:
- default:
- return null;
- case 4:
- return null;
- case 5:
- return null;
- }
- }
-
- public boolean commitPendingEdits(boolean var1) {
- boolean var2 = false;
- var2 = var2 || !this.ipeTable.commitPendingEdits(var1);
- var2 = var2 || !this.xpeTable.commitPendingEdits(var1);
- var2 = var2 || !this.igeTable.commitPendingEdits(var1);
- var2 = var2 || !this.xgeTable.commitPendingEdits(var1);
- var2 = var2 || !this.notTable.commitPendingEdits(var1);
- var2 = var2 || !this.piTable.commitPendingEdits(var1);
- var2 = var2 || !this.nsTable.commitPendingEdits(var1);
- var2 = var2 || !this.dtTable.commitPendingEdits(var1);
- return !var2;
- }
-
- protected BaseAction createCutAction() {
- return this.cutAction;
- }
-
- protected BaseAction createCopyAction() {
- return this.copyAction;
- }
-
- protected BaseAction createPasteAction() {
- return this.pasteAction;
- }
-
- protected BaseAction createClearAction() {
- return this.clearAction;
- }
-
- protected BaseAction createExpandAction() {
- return this.expandAction;
- }
-
- public int getTabOfDecl(BaseDeclaration var1) {
- if (var1 instanceof GeneralEntityDeclaration) {
- return 0;
- } else if (var1 instanceof ParameterEntityDeclaration) {
- return 1;
- } else if (var1 instanceof ExternalSubset) {
- return 1;
- } else if (var1 instanceof NotationDeclaration) {
- return 2;
- } else if (var1 instanceof ProcessingInstruction) {
- return 5;
- } else if (var1 instanceof NamespaceDeclaration) {
- return 4;
- } else {
- return var1 instanceof DataTypeDeclaration ? 3 : -1;
- }
- }
-
- public boolean select(BaseDeclaration var1) {
- return this.select(var1, true);
- }
-
- public boolean select(BaseDeclaration var1, boolean var2) {
- if (!var2 && this.tabPane.getSelectedIndex() != this.getTabOfDecl(var1)) {
- this.getCurrentTable().select((BaseDeclaration)null);
- return false;
- } else {
- if (var1 instanceof InternalGEDeclaration) {
- this.tabPane.setSelectedIndex(0);
- this.igeTable.select(var1);
- } else if (var1 instanceof ExternalGEDeclaration) {
- this.tabPane.setSelectedIndex(0);
- this.xgeTable.select(var1);
- } else if (var1 instanceof InternalPEDeclaration) {
- this.tabPane.setSelectedIndex(1);
- this.ipeTable.select(var1);
- } else if (var1 instanceof ExternalSubset) {
- if (!var2 && this.tabPane.getSelectedIndex() != 1) {
- return false;
- }
-
- this.tabPane.setSelectedIndex(1);
- this.xpeTable.select(((CompositePane)this).getSchemaDoc().getNamedDeclaration(var1.getName(), Class.forName("com.extensibility.xml.ParameterEntityDeclaration")));
- } else if (var1 instanceof ExternalPEDeclaration) {
- this.tabPane.setSelectedIndex(1);
- this.xpeTable.select(var1);
- } else if (var1 instanceof NotationDeclaration) {
- this.tabPane.setSelectedIndex(2);
- this.notTable.select(var1);
- } else if (var1 instanceof ProcessingInstruction) {
- this.tabPane.setSelectedIndex(5);
- this.piTable.select(var1);
- } else if (var1 instanceof NamespaceDeclaration) {
- this.tabPane.setSelectedIndex(4);
- this.nsTable.select(var1);
- } else {
- if (!(var1 instanceof DataTypeDeclaration)) {
- return false;
- }
-
- this.tabPane.setSelectedIndex(3);
- this.dtTable.select(var1);
- }
-
- return true;
- }
- }
-
- public void declarationRemoved(SchemaDocEvent var1) {
- }
-
- public void declarationInserted(SchemaDocEvent var1) {
- }
-
- public void declarationListChanged(SchemaDocEvent var1) {
- }
-
- public void declarationListReordered(SchemaDocEvent var1) {
- }
-
- public void declarationChanged(SchemaDocEvent var1, DeclarationChangeEvent var2) {
- }
-
- public void flavorChanged(SchemaDocEvent var1) {
- this.setTabs();
- this.updateCurrentTable();
- }
-
- private void setTabs() {
- SchemaFlavorIntf var1 = ((CompositePane)this).getSchemaDoc().getSchema().getFlavor();
- this.tabPane.setEnabledAt(this.getIndexOf(0), var1.isSupported(Class.forName("com.extensibility.xml.GeneralEntityDeclaration")));
- this.tabPane.setEnabledAt(this.getIndexOf(1), var1.isSupported(Class.forName("com.extensibility.xml.ParameterEntityDeclaration")));
- this.tabPane.setEnabledAt(this.getIndexOf(2), var1.isSupported(Class.forName("com.extensibility.xml.NotationDeclaration")));
- this.tabPane.setEnabledAt(this.getIndexOf(5), var1.isSupported(Class.forName("com.extensibility.xml.ProcessingInstruction")));
- this.tabPane.setEnabledAt(this.getIndexOf(4), var1.isSupported(Class.forName("com.extensibility.xml.NamespaceDeclaration")));
- this.tabPane.setEnabledAt(this.getIndexOf(3), var1.isSupported(Class.forName("com.extensibility.xml.DataTypeDeclaration")));
- }
-
- private int getIndexOf(int var1) {
- switch (var1) {
- case 0:
- return this.tabPane.indexOfComponent(this.geSplit);
- case 1:
- return this.tabPane.indexOfComponent(this.peSplit);
- case 2:
- return this.tabPane.indexOfComponent(this.notScroll);
- case 3:
- return this.tabPane.indexOfComponent(this.dtScroll);
- case 4:
- return this.tabPane.indexOfComponent(this.nsScroll);
- case 5:
- return this.tabPane.indexOfComponent(this.piScroll);
- default:
- return -1;
- }
- }
-
- private int getIDOfIndex(int var1) {
- Component var2 = this.tabPane.getComponentAt(var1);
- if (var2 == null) {
- return -1;
- } else if (var2 == this.geSplit) {
- return 0;
- } else if (var2 == this.peSplit) {
- return 1;
- } else if (var2 == this.notScroll) {
- return 2;
- } else if (var2 == this.piScroll) {
- return 5;
- } else if (var2 == this.nsScroll) {
- return 4;
- } else {
- return var2 == this.dtScroll ? 3 : -1;
- }
- }
-
- public void focusDeclaration(BaseDeclaration var1) {
- if (var1 != this.getCurrentTable().getSelectedDecl()) {
- this.select(var1, false);
- }
- }
- }
-